Skip to content

unify(ini): Merge and move INI parser files to Core#2863

Merged
githubawn merged 2 commits into
TheSuperHackers:mainfrom
githubawn:unify/ini-multiplayer
Jul 12, 2026
Merged

unify(ini): Merge and move INI parser files to Core#2863
githubawn merged 2 commits into
TheSuperHackers:mainfrom
githubawn:unify/ini-multiplayer

Conversation

@githubawn

Copy link
Copy Markdown

Generals gains "MultiplayerSettings::addStartingMoneyChoice", doesn't affect user facing UI.

Move 24 files from GeneralsMD/Code/GameEngine/Source/Common/INI/* to Core/GameEngine/Source/Common/INI/*

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR unifies 24 INI parser files by moving them from game-specific locations (Generals/ and GeneralsMD/) into the shared Core/ layer, so both builds compile the same source. Alongside the reorganization, it adds a working implementation of MultiplayerSettings::addStartingMoneyChoice to the Generals build (GeneralsMD already had it), wiring up the MultiplayerStartingMoneyChoice INI block end-to-end.

  • CMakeLists.txt updates (3 files): The 24 INI source files are enabled in Core/GameEngine/CMakeLists.txt and commented out in both Generals/ and GeneralsMD/ counterparts. The game-specific Generals/ copies of those .cpp files are deleted.
  • addStartingMoneyChoice implementation: Added to Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp; the function, member variables, and dispatch-table entry in Core/GameEngine/Source/Common/INI/INI.cpp are already present in Core, so the feature is now fully functional for Generals.
  • Script housekeeping: scripts/cpp/unify_move_files.py gains commented-out entries recording the 24 files completed in this batch.

Confidence Score: 5/5

Safe to merge — the file moves are mechanical, the CMakeLists.txt changes are symmetric across all three builds, and the new addStartingMoneyChoice logic is correct and consistent with the already-working GeneralsMD implementation.

The unification is structurally sound: 24 files are enabled in Core and disabled in the game-specific build lists with no duplicate symbols. The addStartingMoneyChoice implementation is logically correct, properly guarded by DEBUG_ASSERTCRASH, and its declaration, member fields, and dispatch-table registration were already in place. No data loss or behavioral regression is introduced.

No files require special attention. Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp has a minor indentation inconsistency in the new function but is otherwise correct.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp Adds addStartingMoneyChoice implementation and initializes m_gotDefaultStartingMoney in the constructor; logic is correct but uses 2-space indentation inconsistent with the rest of the file (tab-indented).
Core/GameEngine/CMakeLists.txt Enables 24 INI source files previously commented out; straightforward and consistent with the unification goal.
Generals/Code/GameEngine/CMakeLists.txt Comments out the same 24 INI files that were moved to Core, preventing duplicate symbol definitions; correct and symmetric with Core's changes.
GeneralsMD/Code/GameEngine/CMakeLists.txt Same pattern as Generals — comments out the 24 INI files now provided by Core; correct.
Core/GameEngine/Source/Common/INI/INIMultiplayer.cpp Full implementation of parseMultiplayerStartingMoneyChoiceDefinition is present; correctly calls TheMultiplayerSettings->addStartingMoneyChoice which is now implemented in both Generals and GeneralsMD builds.
scripts/cpp/unify_move_files.py Adds 24 commented-out unify_file calls to record completed work; no functional change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[INI File: MultiplayerStartingMoneyChoice] --> B[INI::parseMultiplayerStartingMoneyChoiceDefinition\nCore/GameEngine/Source/Common/INI/INIMultiplayer.cpp]
    B --> C{isDefault?}
    C -- yes --> D[DEBUG_ASSERTCRASH if already have default]
    D --> E[TheMultiplayerSettings->addStartingMoneyChoice]
    C -- no --> E
    E --> F[m_startingMoneyList.push_back]
    E --> G{isDefault?}
    G -- yes --> H[m_defaultStartingMoney = money\nm_gotDefaultStartingMoney = true]
    G -- no --> I[Done]
    H --> I

    subgraph "Build Sources - Before PR"
        J[Generals/Code/.../INIMultiplayer.cpp stub impl]
        K[GeneralsMD/Code/.../INIMultiplayer.cpp full impl]
    end

    subgraph "Build Sources - After PR"
        L[Core/GameEngine/.../INIMultiplayer.cpp full impl - shared]
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[INI File: MultiplayerStartingMoneyChoice] --> B[INI::parseMultiplayerStartingMoneyChoiceDefinition\nCore/GameEngine/Source/Common/INI/INIMultiplayer.cpp]
    B --> C{isDefault?}
    C -- yes --> D[DEBUG_ASSERTCRASH if already have default]
    D --> E[TheMultiplayerSettings->addStartingMoneyChoice]
    C -- no --> E
    E --> F[m_startingMoneyList.push_back]
    E --> G{isDefault?}
    G -- yes --> H[m_defaultStartingMoney = money\nm_gotDefaultStartingMoney = true]
    G -- no --> I[Done]
    H --> I

    subgraph "Build Sources - Before PR"
        J[Generals/Code/.../INIMultiplayer.cpp stub impl]
        K[GeneralsMD/Code/.../INIMultiplayer.cpp full impl]
    end

    subgraph "Build Sources - After PR"
        L[Core/GameEngine/.../INIMultiplayer.cpp full impl - shared]
    end
Loading

Reviews (2): Last reviewed commit: "unify(ini): Move INI parser files to Cor..." | Re-trigger Greptile

@xezon xezon changed the title unify(common-ini): Move shared INI loaders to Core unify(ini): Merge and move INI parser files to Core Jul 12, 2026

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Commit titles need pull id.

@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels Jul 12, 2026
@xezon xezon added this to the Code foundation build up milestone Jul 12, 2026
@githubawn githubawn force-pushed the unify/ini-multiplayer branch from d477f32 to 6bd07d5 Compare July 12, 2026 23:06
@githubawn githubawn merged commit b70e160 into TheSuperHackers:main Jul 12, 2026
17 checks passed
@githubawn githubawn deleted the unify/ini-multiplayer branch July 12, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants